package com.smh.genericity;

import org.junit.Test;
import sun.rmi.runtime.Log;

import java.util.ArrayList;
import java.util.List;

/**
 * @description: 泛型初体验A测试
 * @author: shenmhk
 * @create: 2020-10-21 9:10
 */
public class GenericityTest {

    @Test
    public void Test1(){
        List arrayList = new ArrayList();
        arrayList.add("aaa"); //集合加入字符
        arrayList.add(123);   //集合加入整数

        for (int i = 0; i < arrayList.size(); i++) {
            String item = (String)arrayList.get(i);
            System.err.println("泛型测试：item = "+item);
        }
    }

    @Test
    public void Test2(){
        List<String> sList = new ArrayList<String>();
        List<Integer> iList = new ArrayList<Integer>();
        System.out.println(sList.getClass() == iList.getClass());
    }
}
